package com.nextgen.helper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.nextgen.bean.Asin;

public class ServiceUtils {

	public static Map<String, List<Asin>> getCategoryBasedJson(
			List<Asin> dataList) {
		Map<String, List<Asin>> map = new HashMap<String, List<Asin>>();
		for (Asin dataObj : dataList) {
			String asincategory = dataObj.getAsinCategory();
			if (map.containsKey(asincategory)) {
				List<Asin> data = map.get(asincategory);
				data.add(dataObj);
				map.put(asincategory, data);
			} else {
				List<Asin> data = new ArrayList<Asin>();
				data.add(dataObj);
				map.put(asincategory, data);
			}
		}
		return map;
	}

}
